

const mongoose = require('mongoose')
const Schema = mongoose.Schema

// 测试用

let msgSchema = new Schema(
    {
      // 留言
      msg:{
        type: String,
        required: true
      },
      // 用户
      user: {
        type: Schema.Types.ObjectId,
        ref: 'user'
      },
      // 反馈
      reports: [Number],
      // 子文档
      children:[{
        // 留言
        msg:{type: String, required: true},      
        // 用户
        user: {type: Schema.Types.ObjectId, ref: 'user', required: true},
        // 反馈
       reports: [Number]
      }]
    },
    {
      versionKey:false
    }
  )